/**
 * @fileOverview entry file
 * @author huangtonger@aliyun.com
 */

const Editor = require('./editor/');
const Util = require('./util/');
const Command = require('./command/');
const version = require('./version');
// // const G6 = require('@antv/g6');
const G6 = require('../../g6/src');

Editor.Editor = Editor;
Editor.Util = Util;
Editor.Diagram = require('./page/diagram/');
Editor.Page = require('./page/base/');
Editor.Flow = require('./page/flow/');
Editor.Koni = require('./page/koni/');
Editor.Mind = require('./page/mind/');
Editor.Minimap = require('./minimap/');
Editor.Toolbar = require('./toolbar/');
Editor.Contextmenu = require('./contextmenu/');
Editor.Itempanel = require('./itempanel/');
Editor.Detailpanel = require('./detailpanel/');
Editor.Command = require('./command/');
Editor.BPMN = require('./page/bpmn');
Editor.registerBehaviour = Editor.Page.registerBehaviour;
Editor.registerNode = Editor.Page.registerNode;
Editor.registerEdge = Editor.Page.registerEdge;
Editor.registerGroup = Editor.Page.registerGroup;
Editor.registerGuide = Editor.Page.registerGuide;
Editor.registerCommand = Command.registerCommand;
Editor.version = version;

// Compatible with misspelling
Editor.Itempannel = Editor.Itempanel;
Editor.Detailpannel = Editor.Detailpanel;

// track
Editor.track = cfg => {
  const defaultCfg = {
    G6Editor: true
  };
  if (Util.isObject(cfg)) {
    G6.track({
      ...defaultCfg,
      ...cfg
    });
  } else {
    if (cfg) {
      G6.track(defaultCfg);
    } else {
      G6.track(cfg);
    }
  }
};
Editor.track(true);
module.exports = Editor;
